<div class="conRight" id="conRight">
	<div class="AllcontentList" id="AllcontentList"></div>
</div>
<style>
	.fwjg2{
		float: left;
		color: blue;
		line-height: 25px;
		width: 845px;
	}
	.content .conRight .contentList .contentListUl li .bzsm{
		max-width: 835px;
		float: left;
		white-space: normal;
	}
	.bzsm a{
		color: blue;
		text-decoration: underline;
		margin-right: 10px;
	}
</style>
<script id="conRightText" type="text/html">
	<div class="contentList detailsList" >
		<h1 class="contentListName detailsListName" id="detailsList">{{d.titles}}</h1>
		<ul class="contentListUl">
			<li style="width: 100%;height: auto;"><i style="float:left;line-height:20px;">发文机关</i>
				<span class="fwjg2" data-fieldId ="{{d.fieldId}}" style="max-width: 750px;white-space: normal;height: auto;">
					{{#  if(d.authors){ }}{{d.authors}}{{#  } }}
				</span>
			</li>
			<li><i>文&nbsp;&nbsp;&nbsp;&nbsp;号</i><span>{{#  if(d.keyword){ }}{{d.keyword}}{{#  } }} </span></li>
			<li><i>发布日期</i><span>{{#  if(d.openTime){ }}{{d.openTime}}{{#  } }} </span></li>
			<li><i>时效性</i><span>{{#  if(d.timeliness){ }}{{d.timeliness}}{{#  } }}</span></li>
			<li><i>生效日期</i><span>{{#  if(d.effectiveTime){ }}{{d.effectiveTime}}{{#  } }} </span></li>
			
			{{#  if(d.source){ }}<li style="width: 100%;height: auto;"><i style="float:left;line-height:25px;" >编者说明</i><span class="bzsm" title="{{d.source}}">{{d.source}}</span></li>{{#  } }}
		</ul>
	</div>
	<p class="mainText">正文</p>
	<div class="detailShare">
		<ul class="fontList">
			<li data-multiples='1.2'>[大]</li>
			<li class="first" data-multiples='1'>[中]</li>
			<li data-multiples='0.8'>[小]</li>
		</ul>
	</div>
	<pre class="detailContent" id="detailContent">{{#  if(d.context){ }}{{d.context}}{{#  } }}</pre>
</script>
<script>
layui.use(['Router','laytpl','Zutil','Policylist'], function() {
	var Router = layui.Router;
	var laytpl = layui.laytpl;
	var Zutil = layui.Zutil;
	var policiesId = Zutil.getQueryString('policiesId');
	var resultData;
	var FieldUrl = Router.link.costnorm.get;
	$.post(FieldUrl,{"policiesId":policiesId},function(result){
		var conRight = conRightText.innerHTML;
		laytpl(conRight).render(result.data, function(html){	
			$("#conRight").html(html);
			resultData = result.data.fieldId;
			var aheight = $("body").height();
			$('#policyInfo', parent.document).height(aheight+50)
		});
		var bzsmHtml = $(".bzsm").html();
		if (bzsmHtml != undefined) {
			$(".bzsm").html(bzsmHtml.replace(/<\/?[^>]*>/g,''));
		}
	
		
for (i = 0 ; i < $(".fwjg2").length ; i++) {
	var str = $(".fwjg2").eq(i).html();
	$(".fwjg2").eq(i).html("");
	var arr = str.split(";");
	var json = {};
	var num;
	arr.length == 1 ? num1 = 1 : num1 = arr.length-1 ;
    for(var j = 0 ; j < num1 ; j++){
         var name = arr[j].match(/[^#]+(?=[#])/g)? arr[j].match(/[^#]+(?=[#])/g)[0] :arr[j] ;
         var num  =  arr[j].match(/[^#]+(?=[#])/g)? arr[j].match(/#(\S*)/)[1] :0;
         json[name] = num;
    }
    var arr2 = [];
    for(name in json){
    	arr2.push({"name":name,"num":json[name]})
    	
	}
    arr2.sort(function (a,b){
    	return a.num-b.num;
    })

	for(k = 0 ; k < arr2.length ; k++){
		var authors = arr2[k].name.trim();
		$(".fwjg2").eq(i).append("<a href='/ceca_two/modules/policy/policyList.html?authors="+window.btoa(Zutil.encodeURI(authors))+"'  style='color:#333;font-weight: normal;width:auto;margin-right:10px;color:blue;cursor: pointer;'>"+arr2[k].name+"</a>")
	}

}
		
$(".fwjg2 a").on("click",function (){

	var search=Router.link.costnorm.search;
	var obj={};
	var thisVal = $(this).html();
	obj.authors = thisVal;
	obj.maxopenTime = "";
	obj.minopenTime = "";
	obj.keyword = "";
	obj.timeliness = "";
	obj.mineffectiveTime = "";
	obj.maxeffectiveTime = "";
	obj.key =  "";    //Zutil.encodeURI($("#key").val());
	obj.pageNumber = obj.pageNumber|| 1;
	obj.pageSize = obj.pageSize || 10;
	getList(obj);
})
		var arr = [];
		for (i = 0 ; i < $("#detailContent *").length ; i++) {
			arr.push($("#detailContent *").eq(i).attr("style"));
			typeof(arr[i]) == 'undefined' ? arr[i] = $("#detailContent *").eq(i).css("font-size"):arr[i] = $("#detailContent *").eq(i).css("font-size");
			arr[i] = arr[i].substring(0,2);
		}
		
		$(".fontList li").on("click",function(){
			
			if($(this).hasClass("first"))return false;
			$(this).addClass("first").siblings().removeClass('first');
			var multiples = parseFloat($(this).attr("data-multiples") || 0);
			
			var thisIndex = $(this).index();
			
			function qqq (obj){
				for (i = 0 ; i < $("#detailContent *").length ; i++) {
					$("#detailContent *").eq(i).css("font-size",arr[i]*obj+"px")
				}
			}
			switch (thisIndex){
				case 0:qqq(1.2);break;
				case 1:qqq(1);break;
				case 2:qqq(10/12);break;
				default:break;
			}
			
			
		});
		
		
		
function getList(obj){
		var search=Router.link.costnorm.search;
		if(Zutil.getQueryString("policiesId")) return false;
		
		$.post(search,obj,function(result){
			var  data = result.data;
			console.log(data)
			laytpl(AllcontentListText.innerHTML).render(data.list, function(html){	
				AllcontentList.innerHTML = html;
			});
			for (i = 0 ; i < data.list.length ; i++){
				var s = data.list[i].abstract ? data.list[i].abstract:"";
				var dd=s;
				console.log(dd);
				$(".contentListP").eq(i).html(dd);
			}
			for (i = 0 ; i < $(".fwjg").length ; i++) {
				var str = $(".fwjg").eq(i).html() || "";
				$(".fwjg").eq(i).html("");
				var arr = str.split(";;");
				var json = {};
				var num;
				arr.length == 1 ? num = 2 : num = arr.length ;
			    for(var j = 0 ; j < num; j++){
			        var name = arr[j].match(/[^#]+(?=[#])/g);
			        var num  = arr[j].match(/#(\S*)/)[1];
			        json[name] = num;

			    }
			    var arr2 = [];
			    for(name in json){
		        	arr2.push({"name":name,"num":json[name]})
		        	
		   		}
			    arr2.sort(function (a,b){
			    	return a.num-b.num;
			    })

			    $(".fwjg").eq(i).append("<i href='/ceca_two/modules/policy/policyList.html?authors="+arr2[k].name+"'   style='color: #333;font-weight: normal;width:auto'>"+arr2[0].name+"</i>")
			}
			laypage({
			    cont: 'laypage'
			    ,pages: data.totalPage
			    ,curr:data.pageNumber
			    ,groups:data.pageSize
			    ,skin: '#ff0000'
			    ,jump: function(opt, first){
				    var curr = opt.curr;   //得到了当前页，用于向服务端请求对应数据
				    obj.pageNumber = curr|| 1;
				    if(!first)getList(obj);
				  }
			});
		});
	}
		
	});
});
</script>
<script src="/ceca_two/common/js/limit.js" type="text/javascript" charset="utf-8"></script>